import express from 'express'
import cors from 'cors'
import path from 'path'
import { fileURLToPath } from 'url'

import authRoutes from './routes/auth.routes.js'
import progressRoutes from './routes/progress.routes.js'
import practiceRoutes from './routes/practice.routes.js'
import questionsRoutes from './routes/questions.routes.js'
import healthRoutes from './routes/health.routes.js'
import calculateRoutes from './routes/calculate.routes.js'
import subjectsRoutes from './routes/subjects.routes.js'

const app = express()

// middlewares
app.use(cors())
app.use(express.json())

// routes
app.use('/api/auth', authRoutes)
app.use('/api/progress', progressRoutes)
app.use('/api/practice', practiceRoutes)
app.use('/api/questions', questionsRoutes)
app.use('/api', healthRoutes)
app.use('/api', calculateRoutes)
app.use('/api/subjects', subjectsRoutes)

export default app
